﻿/// ****************************************************************************
/// Author:	        Robin Zhu
/// Create Date:	2012-4-16
/// Purpose: 		成员身份服务接口
/// ****************************************************************************
/// Modify By		Date			Remark
/// Robin           2012-4-24       为接口增加WCF的特性
/// Robin           2012-6-4        增加AddUserToApp方法
/// ****************************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Security;
using System.ServiceModel;

namespace RB.Web.Security
{
    [ServiceContract]
    public interface IMembershipService
    {
        [OperationContract]
        bool CreateUser(UserAccount userAccount);

        [OperationContract]
        bool DeleteUser(string username, bool deleteAllRelatedData, string deleteBy);

        [OperationContract]
        IList<UserAccount> FindUsersByEmail(string emailToMatch);

        [OperationContract]
        IList<UserAccount> FindUsersByName(string usernameToMatch);

        [OperationContract]
        IList<UserAccount> GetAllUsers();

        [OperationContract]
        int GetNumberOfUsersOnline(int userIsOnlineTimeWindow);

        [OperationContract]
        UserAccount GetUserByName(string username, bool userIsOnline);

        [OperationContract]
        [ServiceKnownType(typeof(UserAccount))]
        UserAccount GetUserByKey(Guid providerUserKey, bool userIsOnline);

        [OperationContract]
        UserAccount GetUserByEmail(string email);

        [OperationContract]
        bool UnlockUser(string userName);

        [OperationContract]
        void UpdateUser(UserAccount user);

        [OperationContract]
        bool LoginUser(string username, string password, int maxInvalidPasswordAttempts, int passwordAttemptWindow);

        [OperationContract]
        bool ValidateUser(string username, string password);

        [OperationContract]
        bool ChangePassword(string username, string newPassword, string changeBy);

        [OperationContract]
        bool ChangePasswordQuestionAndAnswer(string username, string newPasswordQuestion, string newPasswordAnswer, string changeBy);

        [OperationContract]
        string GetPassword(string username);

        [OperationContract]
        bool ValidatePasswordAnswer(string username, string answer);

        [OperationContract]
        void AddUserToApp(Guid userId, string appCode, string createBy);
    }
}
